﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace VideoCarousel.Entity
{
    public class mediaInfo
    {
        [SqlSugar.SugarColumn(IsPrimaryKey =true)]
        public int id { get; set; } = 1;
        public int IsFull { get; set; }
        public int PlayType { get; set; }
        public int Vol { get; set; }
        
        public static mediaInfo Get()
        {
           var c = SqlSugarHelp.GetInstance().Queryable<mediaInfo>().Count();
            var foo = SqlSugarHelp.GetInstance().Queryable<mediaInfo>().Where(it=>it.id==1).ToList();
            if(foo.Count>0)
                return foo[0];
            var a = new mediaInfo();
            SqlSugarHelp.GetInstance().Insertable(a).ExecuteCommand();
           
            return a;
        }
        public void Update()
        {
            SqlSugarHelp.GetInstance().Updateable(this).ExecuteCommand();
        }
    }
}
